home *** CD-ROM | disk | FTP | other *** search
/ Aminet 8 / Aminet 8 (1995)(GTI - Schatztruhe)[!][Oct 1995].iso / Aminet / comm / cnet / TrdWars23.lha / TwNightlyMaint < prev    next >
Text File  |  1993-08-09  |  18KB  |  777 lines

  1. /*   TradeWars 2.3 Nightly Maintenance
  2.      Written by Chris Cowan
  3.      The Danger Zone (502)/448-1155 (300-19.2k Baud)          */
  4.  
  5. options results
  6. bufferflush
  7. PF = 'PFILES:TRADEWARS/'
  8. PFP = 'PFILES:TRADEWARS/players/'
  9. PFU = 'PFILES:TRADEWARS/universe/'
  10. PFT = 'PFILES:TRADEWARS/teams/'
  11. dir6 = "PFILES:TRADEWARS/text/"
  12. dir7 = "PFILES:TRADEWARS/messages/"
  13. dir8 = "RAM:tw/"
  14. space = '                                        '
  15. date = date('U')
  16. seed=random(1,100,time('s'))
  17. signal on error
  18. signal on syntax
  19. signal on ioerr
  20. if ~exists('ram:tw') then do;sendstring '$0makedir "ram:tw"}';end
  21. startmaint:
  22. var=0
  23. transmit "f1n1c4            =-= TRADEWARS 2.3 NIGHTLY MAINTENANCE NOW RUNNING =-="
  24. if exists(dir8"Player!") then do
  25.  transmit "c1n2There is a player in the game!  Waiting until they are done..."
  26.  var=1
  27. end
  28. startmaint2:
  29. if exists(dir8"Player!") then do;sendstring "w5";signal startmaint2;end
  30. if var=1 then signal startmaint
  31. call open(file, dir8"Maint!", "W")
  32. an="In Use!"
  33. call writeln file, an
  34. call close(file)
  35. call open(file, PF'_universe.data', 'R')
  36. ns=readln(file)
  37. cbs=readln(file)
  38. call close(file)
  39. call open file, (PF'_config.data'), 'R'
  40. am.1 = readln(file)
  41. am.2 = readln(file)
  42. am.3 = readln(file)
  43. am.4 = readln(file)
  44. am.5 = readln(file)
  45. am.6 = readln(file)
  46. am.7 = readln(file)
  47. am.8 = readln(file)
  48. am.9 = readln(file)
  49. am.10 = readln(file)
  50. am.11 = readln(file)
  51. call close file
  52. filen = PF'_rates.data'
  53. call open file, (filen), 'R'
  54. c.1 = readln(file)
  55. c.2 = readln(file)
  56. call close file
  57.  
  58. yoopa:
  59. call checkdate
  60. signal sectormaint
  61.  
  62. checkdate:
  63. If exists(PF'_date.data') then do
  64.   call open file, (PF'_date.data'), 'R'
  65.   tt.1 = readln(file)
  66.   call close file
  67.   if tt.1 = date('U') then do
  68.    transmit "n1c7Maintenance has already been ran today!"
  69.    return
  70.   end
  71. end
  72.  
  73. maint:
  74.  
  75. dlete:
  76. transmit 'n1c1Deleting Inactive Players...'
  77. call teloop
  78. ur = 0
  79. x = 0
  80. cop = 0
  81. yoop:
  82. x = x + 1
  83. if x > 40 then signal checkvars
  84. user = PFP'p' x
  85. call open file, (user), 'R'
  86. do y = 1 to 31
  87. pl.x.y = readln(file)
  88. end
  89. call close file
  90. signal yoop
  91.  
  92. checkvars:
  93. x = 0
  94. checkvars2:
  95. x = x + 1
  96. if x > 40 then signal dlete2
  97. if left(pl.x.1,1) = "." then signal checkvars2
  98. do y = 2 to 5
  99.  if datatype(pl.x.y) ~= "NUM" then call dataerror
  100. end
  101. do y = 7 to 15
  102.  if datatype(pl.x.y) ~= "NUM" then call dataerror
  103. end
  104. do y = 17 to 31
  105.  if datatype(pl.x.y) ~= "NUM" then call dataerror
  106. end
  107. signal checkvars2
  108.  
  109. dataerror:
  110. a = "c1WARNING!  A data error has been detected by TwNightlyMaint!!"
  111. b = "Line c7"||y||"c1 of your pfiles:tradewars/players/c7p "||x||"c1 is corrupt!n1"
  112. if exists(dir7"maintlog") then do
  113.  call open file, (dir7"maintlog"), "A"
  114.  signal dataerror2
  115. end
  116. call open file, (dir7"maintlog"), "W"
  117. dataerror2:
  118. call writeln file, a
  119. call writeln file, b
  120. call close file
  121. return
  122.  
  123. dlete2:
  124. cop = cop + 1
  125. if cop > 40 then signal interest
  126. bo = pl.cop.14
  127. if left(pl.cop.1,1) = '.' then signal dlete2
  128. if bo = '' then signal dlete2
  129. datc = date('c')
  130. temp = left(pl.cop.1,1)
  131. x = datc - bo
  132. if x > am.6  & temp ~= '.' then do
  133.   transmit 'Deleting '||trim(pl.cop.1)||'...'
  134.   a = 'c7'pl.cop.1
  135.   if pl.cop.15 > 0 then a=a||' c2[c7Team'pl.cop.15'c2]'
  136.   a=a||' c6was deleted for inactivity.'
  137.   call newspaperopen
  138. if exists(PFU'fighters') then do
  139.   call open file, (PFU'fighters'), 'R'
  140.   y=0
  141.   do until eof(file)
  142.   y=y+1
  143.   pd.y=readln(file)
  144.   if word(pd.y,1)=pl.cop.2 then do
  145.   i=y
  146.   call cc
  147.   end
  148.   end
  149.   call close file
  150.   call searchun
  151. end
  152.   pl.cop.3 = 0
  153.   pl.cop.4 = 0
  154.   pl.cop.7 = 0
  155.   pl.cop.2= 0
  156.   if pl.cop.15 > 0 then do
  157.     teamnumber = pl.cop.15
  158.     if tle.teamnumber = pl.cop.1 then do
  159.       call disband2
  160.     end
  161.   end   
  162.   pl.cop.1 = '..................'
  163.   pl.cop.15 = 0
  164.   x = cop
  165.   call saveuser
  166.   if exists(dir7''cop) then address command 'delete 'dir7''cop
  167.   if exists(dir7''cop'.msg1') then do
  168.    address command 'delete 'dir7''cop'.msg#?'
  169.   end
  170. end  
  171. signal dlete2    
  172.  
  173. interest:
  174. c.1 = 5
  175. if am.3 = 1 then do
  176.   transmit 'n1c3Setting Today''s Interest Rate...'
  177.   c.1 = random(1,10)
  178. end
  179. transmit 'Posting Interest...'
  180. cop = 0
  181. inter:
  182. cop = cop + 1
  183. if cop = 41 then signal interend
  184. if pl.cop.13 > 0 then do
  185.   x = pl.cop.13
  186.   temp = c.1 / 100
  187.   y = trunc(x*temp)
  188.   x = x + y
  189.   pl.cop.13 = x 
  190.   x = cop
  191.   call saveuser
  192. end
  193. signal inter
  194. interend:
  195. c.2 = 75
  196. if am.4 = 1 then do
  197.   transmit 'n1c2Setting Today''s Klingon/Romulan Bounty...'
  198.   temp = random(0,50)
  199.   c.2 = 50 + temp
  200. end
  201. fixnewspaper:  /* Crazy Cad gets credit here...*/
  202. xx = 30
  203. if xx = 0 then signal bta
  204. filen = dir7||'newspaper'
  205. if ~exists(filen) then signal bta
  206. call open(short,filen, 'R');s=0
  207. do until eof(short)=1
  208.   s=s+1
  209.   line.s = readln(short)
  210. end
  211. s=s-1
  212. call close short
  213. if xx ~=0 & xx<s then do
  214.   transmit 'n1c7Fixing Newspaper...'
  215.   signal off error
  216.   call open(short,filen,'W')
  217.   do i =(s-xx+1) to s
  218.     writeln(short,line.i)
  219.   end
  220.   call close short
  221.   signal on error
  222. end
  223.  
  224. bta:
  225. v=0
  226. bta2:
  227. v=v+1
  228. if ~exists(dir7'ALL.msg'||v) then signal cabal
  229. call open file, (dir7'ALL.msg'||v||'.index'), 'R'
  230. do z=1 to 7;tt.z = readln(file);end
  231. call close file
  232. d=date('c')
  233. a = d - tt.6 
  234. if a < 4 then signal cabal
  235. address command "delete "dir7"ALL.msg"||v
  236. address command "delete "dir7"ALL.msg"||v||".index"
  237. u=v;v=v-1
  238. bta3:
  239. u=u+1;r=u-1
  240. if ~exists(dir7'ALL.msg'||u) then signal bta2
  241. address command "rename "dir7"ALL.msg"||u" as "dir7"ALL.msg"||r
  242. address command "rename "dir7"ALL.msg"||u".index as "dir7"ALL.msg"||r||".index"
  243. signal bta3
  244.  
  245. cabal:
  246. if exists(dir7'cabal') then do
  247. call open file, (dir7'cabal')
  248. z = readln(file)
  249. call close file
  250. a = 'c7'z' c3Klingons c6& c3Romulans c6were killed yesterday.'
  251. call newspaperopen
  252. address command 'delete 'dir7'cabal'
  253. end
  254.  
  255. addklingons:
  256. b = date();a = "n1c5Maintenance - "||b||":  --n1";if am.1 > 0 then call sysoplog
  257. sendstring "n1c6Replenishing Klingons..."
  258. sector=220
  259. call opensector
  260. sd.9=98
  261. if sd.8 < 50000 then sd.8 = 50000
  262. a = sd.8;a = a + 1000;sd.8 = a
  263. if sd.8 > 100000 then sd.8 = 100000
  264. call closesector
  265. sendstring "."
  266. sector=59
  267. call opensector
  268. if sd.9=0 | sd.9=98 then do
  269.  sd.9=98;a = sd.8;a = a + 100;sd.8 = a;if sd.8 > 1000 then sd.8 = 1000;call closesector
  270. end
  271. sendstring "."
  272. sector=310
  273. call opensector
  274. if sd.9=0 | sd.9=98 then do
  275.  sd.9=98;a = sd.8;a = a + 100;sd.8 = a;if sd.8 > 1000 then sd.8 = 1000;call closesector
  276. end
  277. sendstring "."
  278. sector=455
  279. call opensector
  280. if sd.9=0 | sd.9=98 then do
  281.  sd.9=98;a = sd.8;a = a + 100;sd.8 = a;if sd.8 > 1000 then sd.8 = 1000;call closesector
  282. end
  283. sendstring "."
  284. sector=25
  285. call opensector
  286. if sd.9=0 | sd.9=98 then do
  287.  sd.9=98;a = sd.8;a = a + 100;sd.8 = a;if sd.8 > 1000 then sd.8 = 1000;call closesector
  288. end
  289. sendstring "."
  290. sector=395
  291. call opensector
  292. if sd.9=0 | sd.9=98 then do
  293.  sd.9=98;a = sd.8;a = a + 100;sd.8 = a;if sd.8 > 1000 then sd.8 = 1000;call closesector
  294. end
  295. sendstring "."
  296. sector=730
  297. call opensector
  298. if sd.9=0 | sd.9=98 then do
  299.  sd.9=98;a = sd.8;a = a + 100;sd.8 = a;if sd.8 > 1000 then sd.8 = 1000;call closesector
  300. end
  301. sendstring "."
  302. sector=440
  303. call opensector
  304. if sd.9=0 | sd.9=98 then do
  305.  sd.9=98;a = sd.8;a = a + 100;sd.8 = a;if sd.8 > 1000 then sd.8 = 1000;call closesector
  306. end
  307. sendstring "."
  308. sector=68
  309. call opensector
  310. if sd.9=0 | sd.9=98 then do
  311.  sd.9=98;a = sd.8;a = a + 100;sd.8 = a;if sd.8 > 1000 then sd.8 = 1000;call closesector
  312. end
  313. sendstring "."
  314. sector=67
  315. call opensector
  316. if sd.9=0 | sd.9=98 then do
  317.  sd.9=98;a = sd.8;a = a + 100;sd.8 = a;if sd.8 > 1000 then sd.8 = 1000;call closesector
  318. end
  319. sendstring "."
  320.  
  321. moveklingons:
  322. sendstring "n2c3Moving Klingons..."
  323. counter=0
  324. mk2:
  325. counter=counter+1;if counter=6 then signal addromulans
  326. whoops=0
  327. mk3:
  328. whoops=whoops+1;if whoops>200 then do;a = "c1Could not add Klingon group!";if am.1 > 0 then call sysoplog;signal addromulans;end
  329. sector=random(7,999)
  330. if ~exists(PFU'tws'sector) then signal mk3
  331. call opensector
  332. if sd.8>0 & sd.9 ~=98 then signal mk3
  333. if sd.18=3 then signal mk3
  334. sd.9=98;b=random(20,200);sd.8=sd.8+b
  335. call closesector
  336. a = "c6Klingon group added at sector c7"||sector||"c6.";if am.1 > 0 then call sysoplog
  337. sendstring "."
  338. signal mk2
  339.  
  340. addromulans:
  341. sendstring "n2c5Replenishing Romulans..."
  342. sector=560
  343. call opensector
  344. sd.9=99
  345. if sd.8 < 50000 then sd.8 = 50000
  346. a = sd.8;a = a + 1000;sd.8 = a
  347. if sd.8 > 100000 then sd.8 = 100000
  348. call closesector
  349. sendstring "."
  350. sector=54
  351. call opensector
  352. if sd.9=0 | sd.9=99 then do
  353.  sd.9=99;a = sd.8;a = a + 100;sd.8 = a;if sd.8 > 1000 then sd.8 = 1000;call closesector
  354. end
  355. sendstring "."
  356. sector=920
  357. call opensector
  358. if sd.9=0 | sd.9=99 then do
  359.  sd.9=99;a = sd.8;a = a + 100;sd.8 = a;if sd.8 > 1000 then sd.8 = 1000;call closesector
  360. end
  361. sendstring "."
  362. sector=735
  363. call opensector
  364. if sd.9=0 | sd.9=99 then do
  365.  sd.9=99;a = sd.8;a = a + 100;sd.8 = a;if sd.8 > 1000 then sd.8 = 1000;call closesector
  366. end
  367. sendstring "."
  368. sector=185
  369. call opensector
  370. if sd.9=0 | sd.9=99 then do
  371.  sd.9=99;a = sd.8;a = a + 100;sd.8 = a;if sd.8 > 1000 then sd.8 = 1000;call closesector
  372. end
  373. sendstring "."
  374. sector=615
  375. call opensector
  376. if sd.9=0 | sd.9=99 then do
  377.  sd.9=99;a = sd.8;a = a + 100;sd.8 = a;if sd.8 > 1000 then sd.8 = 1000;call closesector
  378. end
  379. sendstring "."
  380. sector=425
  381. call opensector
  382. if sd.9=0 | sd.9=99 then do
  383.  sd.9=99;a = sd.8;a = a + 100;sd.8 = a;if sd.8 > 1000 then sd.8 = 1000;call closesector
  384. end
  385. sendstring "."
  386. sector=81
  387. call opensector
  388. if sd.9=0 | sd.9=99 then do
  389.  sd.9=99;a = sd.8;a = a + 100;sd.8 = a;if sd.8 > 1000 then sd.8 = 1000;call closesector
  390. end
  391. sendstring "."
  392. sector=73
  393. call opensector
  394. if sd.9=0 | sd.9=99 then do
  395.  sd.9=99;a = sd.8;a = a + 100;sd.8 = a;if sd.8 > 1000 then sd.8 = 1000;call closesector
  396. end
  397. sendstring "."
  398. sector=37
  399. call opensector
  400. if sd.9=0 | sd.9=99 then do
  401.  sd.9=99;a = sd.8;a = a + 100;sd.8 = a;if sd.8 > 1000 then sd.8 = 1000;call closesector
  402. end
  403. sendstring "."
  404. sector=13
  405. call opensector
  406. if sd.9=0 | sd.9=99 then do
  407.  sd.9=99;a = sd.8;a = a + 100;sd.8 = a;if sd.8 > 1000 then sd.8 = 1000;call closesector
  408. end
  409. sendstring "."
  410. sector=14
  411. call opensector
  412. if sd.9=0 | sd.9=99 then do
  413.  sd.9=99;a = sd.8;a = a + 100;sd.8 = a;if sd.8 > 1000 then sd.8 = 1000;call closesector
  414. end
  415. sendstring "."
  416. sector=38
  417. call opensector
  418. if sd.9=0 | sd.9=99 then do
  419.  sd.9=99;a = sd.8;a = a + 100;sd.8 = a;if sd.8 > 1000 then sd.8 = 1000;call closesector
  420. end
  421. sendstring "."
  422.  
  423. moveromulans:
  424. sendstring "n2c4Moving Romulans..."
  425. counter=0
  426. mr2:
  427. counter=counter+1;if counter=6 then signal addfederation
  428. whoops=0
  429. mr3:
  430. whoops=whoops+1;if whoops>200 then do;a = "c1Could not add Romulan group!";if am.1 > 0 then call sysoplog;signal addfederation;end
  431. sector=random(7,999)
  432. if ~exists(PFU'tws'sector) then signal mr3
  433. call opensector
  434. if sd.8>0 & sd.9 ~=99 then signal mr3
  435. if sd.18=2 then signal mr3
  436. sd.9=99;b=random(20,200);sd.8=sd.8+b
  437. call closesector
  438. a = "c3Romulan group added at sector c7"||sector||"c3.";if am.1 > 0 then call sysoplog
  439. sendstring "."
  440. signal mr2
  441.  
  442. addfederation:
  443. sendstring "n2c7Replenishing Federation ships..."
  444. sector=1
  445. call opensector
  446. sd.9=97
  447. if sd.8 < 50000 then sd.8 = 50000
  448. a = sd.8;a = a + 1000;sd.8 = a
  449. if sd.8 > 100000 then sd.8 = 100000
  450. call closesector
  451. sendstring "."
  452. sector=89
  453. call opensector
  454. if sd.9=0 | sd.9=97 then do
  455.  sd.9=97;a = sd.8;a = a + 100;sd.8 = a;if sd.8 > 1000 then sd.8 = 1000;call closesector
  456. end
  457. sendstring "."
  458. sector=320
  459. call opensector
  460. if sd.9=0 | sd.9=97 then do
  461.  sd.9=97;a = sd.8;a = a + 100;sd.8 = a;if sd.8 > 1000 then sd.8 = 1000;call closesector
  462. end
  463. sendstring "."
  464. sector=365
  465. call opensector
  466. if sd.9=0 | sd.9=97 then do
  467.  sd.9=97;a = sd.8;a = a + 100;sd.8 = a;if sd.8 > 1000 then sd.8 = 1000;call closesector
  468. end
  469. sendstring "."
  470. sector=955
  471. call opensector
  472. if sd.9=0 | sd.9=97 then do
  473.  sd.9=97;a = sd.8;a = a + 100;sd.8 = a;if sd.8 > 1000 then sd.8 = 1000;call closesector
  474. end
  475. sendstring "."
  476. sector=61
  477. call opensector
  478. if sd.9=0 | sd.9=97 then do
  479.  sd.9=97;a = sd.8;a = a + 100;sd.8 = a;if sd.8 > 1000 then sd.8 = 1000;call closesector
  480. end
  481. sendstring "."
  482. sector=49
  483. call opensector
  484. if sd.9=0 | sd.9=97 then do
  485.  sd.9=97;a = sd.8;a = a + 100;sd.8 = a;if sd.8 > 1000 then sd.8 = 1000;call closesector
  486. end
  487. sendstring "."
  488. sector=75
  489. call opensector
  490. if sd.9=0 | sd.9=97 then do
  491.  sd.9=97;a = sd.8;a = a + 100;sd.8 = a;if sd.8 > 1000 then sd.8 = 1000;call closesector
  492. end
  493. sendstring "."
  494. sector=48
  495. call opensector
  496. if sd.9=0 | sd.9=97 then do
  497.  sd.9=97;a = sd.8;a = a + 100;sd.8 = a;if sd.8 > 1000 then sd.8 = 1000;call closesector
  498. end
  499. sendstring "."
  500. sector=26
  501. call opensector
  502. if sd.9=0 | sd.9=97 then do
  503.  sd.9=97;a = sd.8;a = a + 100;sd.8 = a;if sd.8 > 1000 then sd.8 = 1000;call closesector
  504. end
  505. sendstring "."
  506. sector=80
  507. call opensector
  508. if sd.9=0 | sd.9=97 then do
  509.  sd.9=97;a = sd.8;a = a + 100;sd.8 = a;if sd.8 > 1000 then sd.8 = 1000;call closesector
  510. end
  511. sendstring "."
  512. sector=610
  513. call opensector
  514. if sd.9=0 | sd.9=97 then do
  515.  sd.9=97;a = sd.8;a = a + 100;sd.8 = a;if sd.8 > 1000 then sd.8 = 1000;call closesector
  516. end
  517. sendstring "."
  518. sector=890
  519. call opensector
  520. if sd.9=0 | sd.9=97 then do
  521.  sd.9=97;a = sd.8;a = a + 100;sd.8 = a;if sd.8 > 1000 then sd.8 = 1000;call closesector
  522. end
  523. sendstring "."
  524.  
  525. moveborg:
  526. borgsector=0
  527. transmit "f1n1c4            =-= TRADEWARS 2.3 NIGHTLY MAINTENANCE NOW RUNNING =-="
  528. transmit "n1c1Moving the Borg..."
  529. if exists(PF'_borg.data') then do
  530. call open file, (PF'_borg.data'), 'R'
  531. borgsector = readln(file)
  532. call close file
  533. end
  534. moveborg2:
  535. var=random(7,999)
  536. if var=borgsector then signal moveborg2
  537. if ~exists(PFU"tws"||var) then signal moveborg2
  538. call open file, (PF'_borg.data'), 'W'
  539. call writeln file, var
  540. call close file
  541. a = "c2Borg moved to sector c7"||var||"c2.";if am.1 > 0 then call sysoplog
  542.  
  543. moveq:
  544. qsector=0
  545. transmit "n1c2Moving Q..."
  546. if exists(PF'_q.data') then do
  547. call open file, (PF'_q.data'), 'R'
  548. qsector = readln(file)
  549. call close file
  550. end
  551. moveq2:
  552. var=random(7,999)
  553. if var=borgsector then signal moveq2
  554. if var=qsector then signal moveq2
  555. if ~exists(PFU"tws"||var) then signal moveq2
  556. call open file, (PF'_q.data'), 'W'
  557. call writeln file, var
  558. call close file
  559. a = "c4Q moved to sector c7"||var||"c4.";if am.1 > 0 then call sysoplog
  560.  
  561. addasteroid:
  562. transmit "n1c7Adding Asteroids..."
  563. x=0;var=random(1,3)
  564. aa2:
  565. x=x+1;if x>var then signal checkcloaking
  566. whoops=0
  567. aa3:
  568. whoops=whoops+1;if whoops>200 then do;a = "c1Could not add Asteroid!";if am.1 > 0 then call sysoplog;signal checkcloaking;end
  569. sector=random(7,999)
  570. if ~exists(PFU'tws'sector) then signal aa3
  571. call opensector
  572. sd.19=sd.19+1
  573. call closesector
  574. a = "c5Asteroid added at sector c7"||sector||"c5.";if am.1 > 0 then call sysoplog
  575. signal aa2
  576.  
  577. checkcloaking:
  578. transmit "n1c6Checking for expired cloaking devices..."
  579. x=0
  580. checkcloak2:
  581. x=x+1;if x=41 then signal done
  582. user=PFP'p' x
  583. call open file, (user), 'R'
  584. do y=1 to 31
  585. pl.x.y=readln(file)
  586. end
  587. call close file
  588. if pl.x.18 > 0 then do
  589.  a=pl.x.18;a=a-1;pl.x.18=a
  590.  call saveuser
  591.  if pl.x.18=0 then transmit "n1c7The U.S.S. "||pl.x.16||" materializes!"
  592. end
  593. signal checkcloak2
  594.  
  595. done:
  596. if exists(PF'_date.data') then address command 'delete 'PF'_date.data'
  597. fle = PF'_date.data'
  598. call open file, (fle), 'W'
  599. call writeln file, date('U')
  600. call close file
  601. if exists(PF'_rates.data') then address command 'delete 'PF'_rates.data'
  602. fle = PF'_rates.data'
  603. call open file, (fle), 'W'
  604. call writeln file, c.1
  605. call writeln file, c.2
  606. call close file
  607. endcheck:
  608. return
  609.  
  610. opensector:
  611. call open(sctor,PFU'tws'sector, 'R')
  612. do yop=1 to 19
  613. sd.yop=readln(sctor)
  614. end
  615. call close(sctor)
  616. return
  617.  
  618. closesector:
  619. call open(sctor,PFU'tws'sector, 'W')
  620. do yop=1 to 19
  621. call writeln(sctor, sd.yop)
  622. end
  623. call close(sctor)
  624. return
  625.  
  626. error:
  627. transmit 'n1Error in Line #' SIGL
  628. signal endit
  629. syntax:
  630. a = SIGL
  631. transmit 'n1Syntax Error In Line #' a
  632. transmit 'Line Reads : >'sourceline(a)'<'
  633. signal endit
  634. ioerr:
  635. transmit 'n1I/O Error In Line #' SIGL
  636. signal endit
  637.  
  638. saveuser:
  639. call open file, (PFP'p' x), 'W'
  640. do y = 1 to 31
  641. call writeln file, pl.x.y
  642. end
  643. call close file
  644. return
  645.  
  646. cnter:
  647. sendstring center(an,linelength)
  648. return
  649.  
  650. newspaperopen:
  651. if exists(dir7'newspaper') then do
  652.   call close file
  653.   call open file, (dir7'newspaper'), 'A'
  654.   call writeln file, a
  655.   call close file
  656.   return
  657. end
  658. call close file
  659. call open file, (dir7'newspaper'), 'W'
  660. call writeln file, a
  661. call close file
  662. return
  663.  
  664. sysoplog:
  665. if exists(dir7'sysoplog') then do
  666.   call close file
  667.   call open file, (dir7'sysoplog'), 'A'
  668.   call writeln file, a
  669.   call close file
  670.   return
  671. end
  672. call close file
  673. call open file, (dir7'sysoplog'), 'W'
  674. call writeln file, a
  675. call close file
  676. return
  677.  
  678. disband2:
  679. teamnumber = pl.cop.15
  680. transmit 'n1c2Disbanding Team...'
  681. x = 0
  682. do x = 1 to 40
  683. if pl.x.15 = teamnumber then do
  684. pl.x.15 = 0
  685. call saveuser
  686. end
  687. end
  688. a = 'c7'tn.teamnumber' c2disbanded due to the deletion of the captain.'
  689. call newspaperopen
  690. tn.teamnumber = '..'
  691. call saveteam
  692.  
  693. teloop:
  694. x = 0
  695. teloop2:
  696. x=x+1
  697. if x>10 then return
  698. fle=PFT't' x
  699. call open file, (fle), 'R'
  700. tn.x = readln(file)
  701. tle.x = readln(file)
  702. tpd.x = readln(file)
  703. call close file
  704. signal teloop2
  705.  
  706. saveteam:
  707. fle = PFT't 'teamnumber
  708. call open file, (fle), 'W'
  709. call writeln file, tn.teamnumber
  710. call writeln file, tle.teamnumber
  711. call writeln file, tpd.teamnumber
  712. call close file
  713. return
  714.  
  715. searchun:
  716. i=0
  717. searchun2:
  718. i=i+1
  719. if i>y then return
  720. if word(pd.i,1)=pl.cop.2 then do
  721. call removef
  722. i=i-1
  723. end
  724. signal searchun2
  725.  
  726. cc:
  727. sector=word(pd.i,2)
  728. call open(sctor,PFU'tws'sector, 'R')
  729. do yop=1 to 19
  730. sd.yop=readln(sctor)
  731. end
  732. call close(sctor)
  733. var=random(1,2)
  734. if var=1 then sd.9=98
  735. if var=2 then sd.9=99
  736. call open(sctor,PFU'tws'sector, 'W')
  737. do yop=1 to 19
  738. call writeln(sctor, sd.yop)
  739. end
  740. call close(sctor)
  741. return
  742.  
  743. removef:
  744. z=0
  745. removef2:
  746. z=z+1
  747. temp=y+1
  748. if z=temp then signal removef3
  749. temp=i+z
  750. an=i+z-1
  751. pd.an=pd.temp
  752. signal removef2
  753. removef3:
  754. y=y-2
  755. call open file, (PFU'fighters'), 'W'
  756. do z=1 to y
  757. call writeln file, pd.z
  758. end
  759. call close file
  760. return
  761.  
  762. newspaperprint:
  763. if exists(dir7'newspaper') then call open(file, dir7'newspaper', 'A')
  764. if ~exists(dir7'newspaper') then call open(file, dir7'newspaper', 'W')
  765. call writeln file, a
  766. call close(file)
  767. drop a
  768. return
  769.  
  770. endit:
  771. sendstring '$0delete 'dir8'Maint!}'
  772. exit
  773.  
  774. sectormaint:
  775. transmit "n2c4NIGHTLY MAINTENANCE COMPLETE!"
  776. signal endit
  777.